package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.WarehouseDao;
import cn.gson.springboot.model.mapper.WarehouseMapper;
import cn.gson.springboot.model.pojos.Warehouse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class WarehouseService {
    @Autowired
    WarehouseMapper warMapper;
    @Autowired
    WarehouseDao warDao;
    public List<Warehouse> selectWarehouse() {
       return warMapper.selectWarehouse();
    }

    @Transactional(transactionManager = "transactionManager")
    public void saveWarehouse(Warehouse warehouse){
        warDao.save(warehouse);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deleteWarehouse(Integer warId){
        warDao.deleteById(warId);
    }
}
